<%@ page contentType="text/html;charset=UTF-8" language="java"  import="java.util.*"%>
<html>
<head>
    <title>登录</title>


</head>
<body>
<%
    String account="";
    String password="";
    Cookie[] cookies = request.getCookies();
    if (cookies!=null){
        for (int i = 0; i < cookies.length; i++) {
            if ("account".equals(cookies[i].getName())){
                account=cookies[i].getValue();
            }
            if ("password".equals(cookies[i].getName())){
                password=cookies[i].getValue();
            }
        }
    }

%>
<form name="dlForm" action="dl.jsp" method="post">
    请您输入账号：<input name="account" type="text"><BR>
    请您输入密码：<input name="password" type="password"><BR>
    <input type="submit"   value="登录">
    <input type="reset" value="取消">
</form>
<%
    String acc = request.getParameter("account");
    String psd = request.getParameter("password");
    if ("123456".equals(acc) && "123456".equals(psd)){
        session.setAttribute("account",acc);
        session.setAttribute("password",psd);
        Cookie accCookie = new Cookie("account",acc);
        Cookie psdCookie = new Cookie("password",psd);
        accCookie.setMaxAge(60*60*24*1);
        psdCookie.setMaxAge(60*60*24*1);

        response.addCookie(accCookie);
        response.addCookie(psdCookie);
        response.setContentType("text/html;charset=UTF-8");
        response.sendRedirect("dl_result.jsp");


    }
%>
</body>
</html>